package com.ruoyi.teaching;


import com.ruoyi.teaching.domain.StageInvestigateDetail;
import com.ruoyi.teaching.util.ExportExcelUtil;

import java.util.*;

public class Data {


    public static void main(String[] args) {
        demo();
    }

    public static void demo() {
        // 项目下的template路径
        String path = "D:\\javaDemo\\RuoYi-Cloud\\ruoyi-modules\\ruoyi-teaching\\src\\main\\resources\\";
        Map<String, Object> map = new HashMap<String, Object>();
        // 模板所在的路径
        map.put("tempFoldPath", path);
        // 生成的路径
        map.put("file", path + "/采购订单.xls");
        // 模板名称
        map.put("tampPath", "学员学习跟进月表.ftl");
        // 最后生成的表格的名称
        map.put("excelName", "采购订单-" + "Demo" + ".xls");
        // 封装数据
        Map<String, Object> exlParam = new HashMap<>();
        exlParam.put("detail", new Data().list());
        // 调用方法,返回浏览器访问的地址
        String downloadUrl = ExportExcelUtil.exportExcel(map, exlParam);
    }

    // 自己造假数据，正常来说都是从数据库查询出来拼装数据的
    public StageInvestigateDetail list() {

        StageInvestigateDetail detail = new StageInvestigateDetail("sunshine", 1L, 1L, 1L, 1L, 1L, 1L, "xxx", "xxx",
                "xxx", "ccc", "sss", "www", 1L, "XXX", new Date());
        return detail;
    }

}
